import request from '@/request/request'

export function getBookList(data) {
  let url = '/admin/book'
  let param = {
    url: url,
    method: 'GET',
    params: data
  }
  return request(param)
}

export function getBookDetail(num) {
  let url = '/admin/book/' + num
  let param = {
    url: url,
    method: 'GET'
  }
  return request(param)
}

export function receiveBook(num) {
  let url = '/admin/book/' + num + '/receive'
  let param = {
    url: url,
    method: 'put'
  }
  return request(param)
}

export function rejectBook(num, rejectReason) {
  let url = '/admin/book/' + num + '/reject'
  let param = {
    url: url,
    method: 'put',
    data: 'reason=' + rejectReason
  }
  return request(param)
}

export function deliveryBook(num) {
  let url = '/admin/book/' + num + '/delivery'
  let param = {
    url: url,
    method: 'put'
  }
  return request(param)
}

export function completeBook(num) {
  let url = '/admin/book/' + num + '/complete'
  let param = {
    url: url,
    method: 'put'
  }
  return request(param)
}
